(function (window) {
	function Resistor(imgResistor, resistance, onWire, x,y,onParallel,parallel) {
		this.initialize(imgResistor, resistance, onWire, x,y,onParallel,parallel);
	}

	Resistor.prototype = new BitmapAnimation();

	Resistor.prototype.resistance = 0;
	Resistor.prototype.onWire = 0;
	Resistor.prototype.onParallel = 0;
	Resistor.prototype.parallel = false;

	Resistor.prototype.BitmapAnimation_initialize = Resistor.prototype.initialize;

	Resistor.prototype.initialize = function(imgResistor, resistance, onWire, x, y,onParallel,parallel) {
		var localSpriteSheet = new SpriteSheet ({
			images: [imgResistor],
			frames: {width: 64, height: 64, regX: 32, regY: 32},
			animations: {
				blink: [0, 6,"blink",2],
				nothing: [0,0,"nothing",2]
			}
		});

		this.BitmapAnimation_initialize(localSpriteSheet);
		this.previousBottom = 0.0;
		this.startTime = Ticker.getTime() / 1000;
		this.elapsed = 0;
		this.x  = x;
		this.y  = y;
		this.resistance = resistance;
		this.onWire = onWire;
		this.onParallel = onParallel;
		this.parallel = parallel;
		this.gotoAndPlay("blink");
	}

	Resistor.prototype.update = function() {
		var time = Ticker.getTime() / 1000;
		this.elapsed = time - this.startTime;
		if(this.currentAnimation.indexOf("blink") != -1) {
			if(this.elapsed >= 0.25) {
				this.gotoAndPlay("nothing");
				this.elapsed = 0;
				this.startTime = time;
			}
		} else {
			if(this.elapsed >= 1.5) {
				this.gotoAndPlay("blink");
				this.elapsed = 0;
				this.startTime = time;
			}
		}
	}

window.Resistor = Resistor;
}(window));